<?php

class PlaceRecord extends TActiveRecord
{
	const TABLE = 'places';
	
	// fields
	/**
	 * @var integer $id
	 * @soapproperty
	 */
	public $id;
	/**
	 * @var string $name
	 * @soapproperty
	 */
	public $name;
	/**
	 * @var string $description
	 * @soapproperty
	 */
	public $description;
	/**
	 * @var integer
	 * @soapproperty $address_id
	 */
	public $address_id;
	
	public function getId()            { return $this->id; }
	public function getName()          { return $this->name; }
	public function getDescription()   { return $this->description; }
	public function getAddressId()     { return $this->address_id; }
	
	public function setId($id)                     { $this->id = $id; }
	public function setName($name)                 { $this->name = $name; }
	public function setDescription($description)   { $this->description = $description; }
	public function setAddressId($address_id)      { $this->address_id = $address_id; }
	
	public function setData($id, $name, $description, $address_id)
	{
		$this->id            = $id;
		$this->name          = $name;
		$this->description   = $description;
		$this->address_id    = $address_id;
	}
	
	public function setDataByPlaceRecord($record)
	{
		if($record instanceof PlaceRecord)
		{
			$this->setData(	$record->getId(), $record->getName(), $record->getDescription(),
							$record->getAddressId());
		}
	}
	
	public function equals($record)
	{
		if($record instanceof PlaceRecord)
		{
			return	$this->getName() == $record->getName()					&&
					$this->getDescription() == $record->getDescription()	&&
					$this->getAddressId()== $record->getAddressId();
		}
		return false;
	}
	
	public static function finder($className=__CLASS__)
	{
		return parent::finder($className);
	}
}

?>